FROM python:3.10-slim-bookworm

WORKDIR /app

COPY docker/lib/cpu                                 \
     /src                                           \
     /app/                              

# llama_cpp_python cpu 环境 + flask + llama-index
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ \
    && pip install --no-cache-dir *.whl \
    && rm -rf *.whl \
    && mv lib*so.* /usr/lib/x86_64-linux-gnu \
    && pip install --no-cache-dir flask==3.0.3 \
    && pip install --no-cache-dir flask-cors==4.0.1 \
    && pip install --no-cache-dir llama-index==0.9.22 \
    && rm -rf $(find /usr/local/lib -name __pycache__)

CMD ["/bin/bash"]